<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    {
        function Box(){

        }
        const obj = new Box();
        // console.log(obj instanceof Box);// true
        // console.log(obj instanceof Object);// true

        Object.prototype.instanceof = function(constructor){
            let L = this;// obj
            const R = constructor;// {}
            while (true){
                if(L.__proto__ === null) return false;
                if(L.__proto__ === R.prototype) return true;
                L = L.__proto__;
            }
        }
        console.log(obj.instanceof(Box));// true
        console.log(obj.instanceof(Object));// true
        console.log(obj.instanceof({}));// false
    }
</script>
</html>